<!--
 * @Author: Binggan
 * @Date: 2020-01-13 15:40:55
 * @LastEditors  : Binggan
 * @LastEditTime : 2020-02-07 14:00:25
 * @Description: 
 -->
<template>
    <div style="height:100%">
        <topHeader :user='user'></topHeader>
        <div class="container clearfix">
            <!-- <div class="nav-box">
                <vue-scroll :ops="ops">
                    <slideNav :style="{height:'100%'}" :userData="user"></slideNav>
                </vue-scroll>
            </div> -->
            <keep-alive>
                <router-view v-if="$route.meta.keepAlive"></router-view>
              </keep-alive>
              <router-view v-if="!$route.meta.keepAlive"></router-view>
        </div>
    </div>
</template>
<script>
import { mapState,mapMutations } from "vuex";
import topHeader from "@/components/topHeader";
export default {
  name: "IndexPage",
  data() {
    return {
      ops: {
        vuescroll: {},
        scrollPanel: {},
        rail: {},
        bar: {
          background: "#b7b7b7"
        }
      }
    };
  },
  components: {
    topHeader,
  },
  computed: {
    ...mapState(["user",]),
    user() {
      let user = this.$store.state.user;
      console.log(user)
      if (!user) {
        this.$router.push("/login")
      } else {
        return user;
      }
    }
  },
  methods:{
    ...mapMutations(["setActiveMenu"]),
  },
  created(){
    // this.getUnreadNum();
  },
  
};
</script>
<style lang="scss">
.container {
  .nav-box,
  .content-box {
    float: left;
  }
  .nav-box {
    width: 240px;
    height: 100%;
    border-right: 1px solid #dcdee2;
    // overflow-y: auto;
  }
  .content-box {
    width: calc(100% - 240px);
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    background-color: rgb(245, 245, 245);
  }
}
.ivu-menu {
  z-index: 0;
  min-height: 100%;
}
</style>

